package structures;

import java.util.*;

/**
 * Image
 * 
 * @author Jose Antonio Prieto
 */
public class Image {

	// =========== Attributes of an Image ===========
	/** Id of the Image */
	private String id;
	/** Next id available */
	private String nextID;
	/** Owner of the Image */
	private String owner;
	// =========== Exif Fields ===========
	/** Manufacturer of image input equipment */
	private String make;
	/** Model of image input equipment */
	private String model;
	/**
	 * The name and version of the software or firmware of the camera or image
	 * input device used to generate the image
	 */
	private String software;
	/** The number of bits per image component */
	private String bitsPerSample;
	/** The compression scheme used for the image data */
	private String compression;
	/** A character string giving the description of the image */
	private String imageDescription;
	/** The date and time of image creation */
	private String dateTime;
	/** Person who created the image */
	private String artist;
	/** Copyright information */
	private String copyright;
	/** The status of flash when the image was shot */
	private String flash;
	/**
	 * A tag for Exif users to write keywords or comments on the image besides
	 * those in ImageDescription
	 */
	private String userComment;
	// =========== Application Properties ===========
	/** Image name */
	private String title;
	/** Place where the photo was taken */
	private String place;
	/** Rate of the photo: Interest */
	private String interest;
	/** Rate of the photo: Quality */
	private String quality;
	/** Rate of the photo: Global */
	private String global;
	/** List of tags of the Image */
	private ArrayList<Tag> tags;
	/** URL of the Image */
	private String URL;

	/**
	 * Constructor
	 */
	public Image() {
		// Atributes Initialization
		id = "";
		nextID = "";
		owner = "";
		// Exif properties Initialization
		make = "";
		model = "";
		software = "";
		bitsPerSample = "";
		compression = "";
		imageDescription = "";
		dateTime = "";
		artist = "";
		copyright = "";
		flash = "";
		userComment = "";
		// Application properties Initialization
		title = "";
		place = "";
		interest = "";
		quality = "";
		global = "";
		tags = new ArrayList<Tag>();
		URL = "";
	}

	/**
	 * To add tags
	 * 
	 * @param k
	 */
	public void addTag(Tag k) {
		tags.add(k);
	}

	/**
	 * Getter
	 * 
	 * @return
	 */
	public String getId() {
		return id;
	}

	/**
	 * Setter
	 * 
	 * @param id
	 */
	public void setId(String id) {
		this.id = id;
	}

	/**
	 * Getter.
	 * @return the nextID
	 */
	public String getNextID() {
		return nextID;
	}

	/**
	 * Setter.
	 * @param nextID the nextID to set
	 */
	public void setNextID(String nextID) {
		this.nextID = nextID;
	}

	/**
	 * Getter
	 * 
	 * @return
	 */
	public String getOwner() {
		return owner;
	}

	/**
	 * Setter
	 * 
	 * @param owner
	 */
	public void setOwner(String owner) {
		this.owner = owner;
	}

	/**
	 * Getter
	 * 
	 * @return
	 */
	public String getArtist() {
		return artist;
	}

	/**
	 * Setter
	 * 
	 * @param artist
	 */
	public void setArtist(String artist) {
		this.artist = artist;
	}

	/**
	 * Getter
	 * 
	 * @return
	 */
	public String getBitsPerSample() {
		return bitsPerSample;
	}

	/**
	 * Setter
	 * 
	 * @param bitsPerSample
	 */
	public void setBitsPerSample(String bitsPerSample) {
		this.bitsPerSample = bitsPerSample;
	}

	/**
	 * Getter
	 * 
	 * @return
	 */
	public String getCompression() {
		return compression;
	}

	/**
	 * Setter
	 * 
	 * @param compression
	 */
	public void setCompression(String compression) {
		this.compression = compression;
	}

	/**
	 * Getter
	 * 
	 * @return
	 */
	public String getCopyright() {
		return copyright;
	}

	/**
	 * Setter
	 * 
	 * @param copyright
	 */
	public void setCopyright(String copyright) {
		this.copyright = copyright;
	}

	/**
	 * Getter
	 * 
	 * @return
	 */
	public String getDateTime() {
		return dateTime;
	}

	/**
	 * Setter
	 * 
	 * @param dateTime
	 */
	public void setDateTime(String dateTime) {
		this.dateTime = dateTime;
	}

	/**
	 * Getter
	 * 
	 * @return
	 */
	public String getFlash() {
		return flash;
	}

	/**
	 * Setter
	 * 
	 * @param flash
	 */
	public void setFlash(String flash) {
		this.flash = flash;
	}

	/**
	 * Getter
	 * 
	 * @return
	 */
	public String getGlobal() {
		return global;
	}

	/**
	 * Setter
	 * 
	 * @param global
	 */
	public void setGlobal(String global) {
		this.global = global;
	}

	/**
	 * Getter
	 * 
	 * @return
	 */
	public String getImageDescription() {
		return imageDescription;
	}

	/**
	 * Setter
	 * 
	 * @param imageDescription
	 */
	public void setImageDescription(String imageDescription) {
		this.imageDescription = imageDescription;
	}

	/**
	 * Getter
	 * 
	 * @return
	 */
	public String getInterest() {
		return interest;
	}

	/**
	 * Setter
	 * 
	 * @param interest
	 */
	public void setInterest(String interest) {
		this.interest = interest;
	}

	/**
	 * Getter
	 * 
	 * @return
	 */
	public String getMake() {
		return make;
	}

	/**
	 * Setter
	 * 
	 * @param make
	 */
	public void setMake(String make) {
		this.make = make;
	}

	/**
	 * Getter
	 * 
	 * @return
	 */
	public String getModel() {
		return model;
	}

	/**
	 * Setter
	 * 
	 * @param model
	 */
	public void setModel(String model) {
		this.model = model;
	}

	/**
	 * Getter
	 * 
	 * @return
	 */
	public String getPlace() {
		return place;
	}

	/**
	 * Setter
	 * 
	 * @param place
	 */
	public void setPlace(String place) {
		this.place = place;
	}

	/**
	 * Getter
	 * 
	 * @return
	 */
	public String getQuality() {
		return quality;
	}

	/**
	 * Setter
	 * 
	 * @param quality
	 */
	public void setQuality(String quality) {
		this.quality = quality;
	}

	/**
	 * Getter
	 * 
	 * @return
	 */
	public String getSoftware() {
		return software;
	}

	/**
	 * Setter
	 * 
	 * @param software
	 */
	public void setSoftware(String software) {
		this.software = software;
	}

	/**
	 * Getter
	 * 
	 * @return
	 */
	public ArrayList<Tag> getTags() {
		return tags;
	}

	/**
	 * Las tag of the image
	 * 
	 * @return
	 */
	public Tag getLastTag() {
		int size = tags.size();
		return tags.get(size - 1);
	}

	/**
	 * Getter
	 * 
	 * @return
	 */
	public String getTitle() {
		return title;
	}

	/**
	 * Setter
	 * 
	 * @param title
	 */
	public void setTitle(String title) {
		this.title = title;
	}

	/**
	 * Getter
	 * 
	 * @return
	 */
	public String getUserComment() {
		return userComment;
	}

	/**
	 * Setter
	 * 
	 * @param userComment
	 */
	public void setUserComment(String userComment) {
		this.userComment = userComment;
	}

	/**
	 * Getter
	 * 
	 * @return the uRL
	 */
	public String getURL() {
		return URL;
	}

	/**
	 * Setter
	 * 
	 * @param url
	 *            the uRL to set
	 */
	public void setURL(String url) {
		URL = url;
	}

	/**
	 * Print of the Image
	 * 
	 * @return
	 */
	public String toString() {
		String res = "<--Image-->\n";
		if (!id.equals("")) {
			res += "\tID: " + id + "\n";
		}
		if (!nextID.equals("")) {
			res += "\tNext ID: " + nextID + "\n";
		}
		if (!owner.equals("")) {
			res += "\tOwner: " + owner + "\n";
		}
		if (!make.equals("")) {
			res += "\tMake: " + make + "\n";
		}
		if (!model.equals("")) {
			res += "\tModel: " + model + "\n";
		}
		if (!software.equals("")) {
			res += "\tSoftware: " + software + "\n";
		}
		if (!bitsPerSample.equals("")) {
			res += "\tBits Per Sample: " + bitsPerSample + "\n";
		}
		if (!compression.equals("")) {
			res += "\tCompression: " + compression + "\n";
		}
		if (!imageDescription.equals("")) {
			res += "\tImage description: " + imageDescription + "\n";
		}
		if (!dateTime.equals("")) {
			res += "\tDate time: " + dateTime + "\n";
		}
		if (!artist.equals("")) {
			res += "\tArtist: " + artist + "\n";
		}
		if (!copyright.equals("")) {
			res += "\tCopyright: " + copyright + "\n";
		}
		if (!flash.equals("")) {
			res += "\tFlash: " + flash + "\n";
		}
		if (!userComment.equals("")) {
			res += "\tUser comment: " + userComment + "\n";
		}
		if (!title.equals("")) {
			res += "\tTitle: " + title + "\n";
		}
		if (!URL.equals("")) {
			res += "\tURL: " + URL + "\n";
		}
		if (!place.equals("")) {
			res += "\tPlace: " + place + "\n";
		}
		if (!interest.equals("")) {
			res += "\t<--Rate-->\n";
			res += "\t\tInterest: " + interest + "\n";
		}
		if (!quality.equals("")) {
			res += "\t\tQuality: " + quality + "\n";
		}
		if (!global.equals("")) {
			res += "\t\tGlobal: " + global + "\n";
		}
		for (Tag i : tags) {
			res += i.toString();
		}
		return res;
	}
}
